package web.demo.utils;

import java.util.List;

import web.demo.entity.Food;

/**
 * 封装所有分页数据，只放分页所需数据
 * 查询结果不放在分页类中
 * */

public class PageBean {
	private int currentPage=1;	//当前页，默认为1
	private int totalPages;		//总的页数，通过总行数和每页行数计算得出
	private int totalRows;		//总的行数
	private int rows=6;			//每页的行数
	private Condition condition;		//查询条件
//	private List<T> pageData;		//每页显示的数据
	public int getCurrentPage() {
		return currentPage;
	}
	//获取总的页数必须在获取到总行数和默认行数的基础上
	public int getTotalPages() {
		if(this.totalRows%this.rows==0){	//可以整除
			this.totalPages=this.totalRows/this.rows;
		}else{	//不能整除，总页数加1
			this.totalPages=this.totalRows/this.rows+1;
		}
		return totalPages;
	}
	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}
	public int getTotalRows() {
		return totalRows;
	}
	public void setTotalRows(int totalRows) {
		this.totalRows = totalRows;
	}
	public int getRows() {
		return rows;
	}
	public void setRows(int rows) {
		this.rows = rows;
	}
	public Condition getCondition() {
		return condition;
	}
	public void setCondition(Condition condition) {
		this.condition = condition;
	}
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}
	
	/*public List<T> getPageData() {
		return pageData;
	}
	public void setPageData(List<T> pageData) {
		this.pageData = pageData;
	}*/
	
}
